{literal}

<script>

function getAddForm(){
		
	$.ajax({
		type: "GET",
		url: "/locale/add-section",
		data: {
			
		},
		success: function(data){
			showPopup(data, 'Add new localization section', false);
		},
		error: function(xhr, statusText, errorThrown){
			showPopup(xhr.responseText, statusText, false);
		}    
	
	});
}

function getEditForm(localeSectionsId){
		
	$.ajax({
		type: "GET",
		url: "/locale/edit-section",
		data: {
			localeSectionsId: localeSectionsId
		},
		success: function(data){
			showPopup(data, 'Edit details', false);
		},
		error: function(xhr, statusText, errorThrown){
			showPopup(xhr.responseText, statusText, false);
		}    
	
	});
}

function deleteSection(localeSectionsId){
	if (confirm('Are you sure you want to remove this localization section?')){
		$.ajax({
			type: "GET",
			url: "/locale/delete-section",
			data: {
				localeSectionsId: localeSectionsId
			},
			success: function(data){
				//showPopup(data, 'Delete section', false);
				window.location.reload();
			},
			error: function(xhr, statusText, errorThrown){
				showPopup(xhr.responseText, statusText, false);
			}
	
		});
		
	}
	return false;
}
</script>

{/literal}

{strip}
<!-- content -->
<div id="content">
    <div id="content_left">
		<a class="button_" ref="#" onclick="getAddForm();">{$commonLocale->t('ADD NEW')}</a><br /><br />
	
	LOCALIZATION SECTIONS<br />
	
	<table cellpadding="2" cellspacing="2" class="activeTable">
		<tr>
			<td>ID</td>
			<td>SECTION</td>
			<td> </td>
			<td> </td>
		</tr>
	{foreach $sections as $s}
		<tr>
			<td>{$s->getId()}</td>
			<td>{$s->getSection()}</td>
			<td><a href="#" onclick="getEditForm({$s->getId()});">EDIT</a></td>
			<td><a href="#" onclick="deleteSection({$s->getId()});">DELETE</a></td>
		</tr>
	{/foreach}
	</table>	
	</div>
	<div id="content_right">
		{include file='admin/menu.tpl'}
		
	</div>
</div>
<!-- end content  -->
{/strip}